package com.stars.pao.junit01;

import java.time.Duration;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.ZonedDateTime;



public class PhoneBillCalculator {
    private static final ZoneId TIME_ZONE = ZoneId.of("America/New_York"); // 假设使用美国纽约时区
    private static final double TARIFF_RATE = 0.05;

    public double calculateBill(LocalDateTime startTime, LocalDateTime endTime) {
        ZonedDateTime startZoned = ZonedDateTime.of(startTime, TIME_ZONE);
        ZonedDateTime endZoned = ZonedDateTime.of(endTime, TIME_ZONE);

        Duration duration = Duration.between(startZoned, endZoned);
        long minutes = (long) Math.ceil(duration.getSeconds() / 60.0);

        if (minutes <= 20) {
            return minutes * 0.05;
        } else {
            return 1.00 + (minutes - 20) * 0.10;
        }
    }
}